import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            int len=scanner.nextInt();
            int[] arr=new int[len];
            for(int i=0;i<len;i++){
                arr[i]=scanner.nextInt();
            }
            Arrays.sort(arr);
            System.out.println(find(arr,0,0,1));
        }
    }
    public static int find(int[] arr,int index,int sum,int product){
        int count=0;
        for(int i=index;i<arr.length;i++){
            sum+=arr[i];
            product*=arr[i];
            if(sum>product){
                count+=1+find(arr,i+1,sum,product);
            }else if(arr[i]==1){
                count+=find(arr,i+1,sum,product);
            }else{
                break;
            }
            sum-=arr[i];
            product/=arr[i];
            while (i<arr.length-1&&arr[i]==arr[i+1]){
                i++;
            }
        }
        return count;
    }
}

























//import java.util.Scanner;
//
//public class Main {
//    public static void main(String[] args) {
//        Scanner scanner=new Scanner(System.in);
//        while (scanner.hasNext()) {
//            int year = scanner.nextInt();
//            int month = scanner.nextInt();
//            int day = scanner.nextInt();
//            int[] arr = {31, 30, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
//            int ret = 0;
//            for (int i = 0; i < month; i++) {
//                ret += arr[i];
//            }
//            if (month > 2 && (year % 4 == 0 && year % 100 == 0 || year % 400 != 0)) {
//                ret -= 1;
//            }
//            System.out.println(ret + day);
//        }
//    }
//}
